//
//  OADSizeViewController.m
//  OASDK_Works
//
//  Created by ChenJie on 3/29/20.
//  Copyright © 2020 Mist. All rights reserved.
//

#import "OADSizeViewController.h"
#import "OASDK.h"

#define kText @"在2020财年，我们将继续\n\
努力地缩减我们的店铺规模专注于将\n\
公司的产品生产力最大化。我们预计全球门店的关\n闭数量等 \n\
同或超过和我们在2019财年的数字（320）。重要的是，我们想强调这些店铺的关闭是我们精简计划非常具体和积极的一部分，和最近的商业趋势无关。” \n\
\n\
GameStop的商业行为最近备受关注，因为它声称自己是“必要零售”，以响应政府要求关闭所有“非必要业务”命令，因此应该被允许持续开业。不过"

//#define kText @"GameStop的商业行为最近备受关注，因为它声称自己是必要零售以响应政府要求关闭所有“非必要业"


#define kLabelFont [UIFont systemFontOfSize:14]

@interface OADSizeViewController ()

@property (nonatomic, strong) UILabel *label;

@end

@implementation OADSizeViewController

#pragma mark - ViewController lifecycle

- (instancetype)init {
    self = [super init];
    if (self) {
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = NSStringFromClass(self.class);
    
    //
    self.label.text = kText;
    [self.view addSubview:self.label];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
}

- (void)viewWillLayoutSubviews {
    [super viewWillLayoutSubviews];
}

- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    
    //
    CGFloat topMark = 0;
    CGFloat marginH = 20;
    CGFloat marginV = 5;
    
    //
    topMark += OA_NAVIGATION_BAR_BOTTOM + marginV;
    CGFloat labelLeft = marginH;
    CGFloat labelMaxWidth = OA_SCREEN_WIDTH - labelLeft * 2;
    CGSize labelSize = [kText oa_sizeWithWidth:labelMaxWidth font:kLabelFont];
    
    self.label.frame = CGRectMake(labelLeft, topMark, labelSize.width, labelSize.height);
    self.label.backgroundColor = OARandomColor(.2);
}

- (UIStatusBarStyle)preferredStatusBarStyle {
    return UIStatusBarStyleLightContent;
}

#pragma mark - Public methods



#pragma mark - Private methods



#pragma mark - Event response methods

- (void)buttonClicked:(UIButton *)button {
    NSLog(@"button clicked...");
}

#pragma mark - Deletate methods



#pragma mark - Setter



#pragma mark - Getter

OAGetLabel(label, ^(UILabel *label){
    label.numberOfLines = 0;
    label.font = kLabelFont;
//    label.lineBreakMode = NSLineBreakByClipping;
})

#pragma mark - Memory management

- (void)dealloc {
}

@end
